package com.gqb.Advice;

import org.springframework.aop.framework.ProxyFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Client {
	public static void main(String[] args) {
	/*	ProxyFactory proxyFactory=new ProxyFactory();
		proxyFactory.setTarget(new GreetImpl());
		proxyFactory.addAdvice(new GreetingBeforeAdvice());
		Greeting greeting=(Greeting) proxyFactory.getProxy();
		greeting.greeting("gqb");*/
		ApplicationContext context=new ClassPathXmlApplicationContext("applicationContext.xml");
//		Greeting greeting=(Greeting) context.getBean("greetingProxy");
		Greeting greeting=(Greeting) context.getBean("greetingImpl");
		try {
			greeting.greeting("Jaaack");
		} catch (Exception e) {
//			e.printStackTrace();
			System.out.println("前置检验不符合，抛出异常");
		}
	/*	GreetingNoInterface grNoInterface=(GreetingNoInterface) context.getBean("greetingNoInterface");
		grNoInterface.greeting("Roooose");*/
		
	}
}
